import cv2
import numpy as np
image = cv2.imread('book.png')
src_pts = np.float32([[120, 27], [352, 37], [46, 350], [315, 370]])
dst_pts = np.float32([[50, 50], [350, 50], [50, 350], [350, 350]])
M=cv2.getPerspectiveTransform(src_pts, dst_pts)
warped_image = cv2.warpPerspective(image, M, (400, 400))
cv2.imshow('Input', image)
cv2.imshow('Perspective', warped_image)
cv2.waitKey()
cv2.destroyAllWindows()